﻿/*
 * Crée par SharpDevelop.
 * Utilisateur: Propriétaire
 * Date: 21/01/2012
 * Heure: 09:21
 * 
 * Pour changer ce modèle utiliser Outils | Options | Codage | Editer les en-têtes standards.
 */
using System;
using System.Windows.Forms;

//using System.Diagnostics;
//using System.Media;
//using System.Collections.Generic;

namespace IPD_GeneralLib
{
    /// <summary>
    /// Description of Affiche_enreg.
    /// </summary>
public partial class Affiche_enregCalendar : Form
 {
    //internal static string AFFENRtext = "" ;
    
    internal static int AFFENRindexenreg = -1 ;
    internal static int AFFENRmaxnumenreg = -1 ;
    
    private static bool bIncomboautoselect = false ;

    
public Affiche_enregCalendar()
    {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();
            
            //
            // TODO: Add constructor code after the InitializeComponent() call.
            //
        }
		
void Affiche_enregCalendarLoad(object sender, EventArgs e)
 {
  this.Text += " Calendar" ;
 
  adaptObjectsForm2DataBaseType() ;
  displaycalendar() ;
}

void adaptObjectsForm2DataBaseType()
 {
   int jj = 0 ;
   comboBox1.Items.Clear() ;
   for (int ii = 0 ; ii < AFFENRmaxnumenreg ; ii++)
      {
        jj = ii + 1 ;
        comboBox1.Items.Add(jj.ToString("0000")) ;
     }
}

void displaycalendar()
 {
// ColSubject 1, 5ColNotes 2, 5ColDateStart 3, 5ColDateEnd 4, ColRecurrence_Type 5, ColRecurrence_Start 6, ColRecurrence_End 7, ColEvery 8
// ColDateAlarm 9, ColLocation 10
   textBox26.Text = IPD_GeneralLib.IPDGeneral.VirtualArray_Calendar[AFFENRindexenreg, IPD_GeneralLib.IPDGeneral.CALENDAR_ColSubject] ;
   textBox25.Text = IPD_GeneralLib.IPDGeneral.VirtualArray_Calendar[AFFENRindexenreg, IPD_GeneralLib.IPDGeneral.CALENDAR_ColNotes] ;
   textBox24.Text = IPD_GeneralLib.IPDGeneral.VirtualArray_Calendar[AFFENRindexenreg, IPD_GeneralLib.IPDGeneral.CALENDAR_ColDateStart] ;
   textBox23.Text  = IPD_GeneralLib.IPDGeneral.VirtualArray_Calendar[AFFENRindexenreg, IPD_GeneralLib.IPDGeneral.CALENDAR_ColDateEnd] ;
   textBox22.Text  = IPD_GeneralLib.IPDGeneral.VirtualArray_Calendar[AFFENRindexenreg, IPD_GeneralLib.IPDGeneral.CALENDAR_ColRecurrence_Type] ;
   textBox15.Text = IPD_GeneralLib.IPDGeneral.VirtualArray_Calendar[AFFENRindexenreg, IPD_GeneralLib.IPDGeneral.CALENDAR_ColRecurrence_Start] ;
   textBox27.Text = IPD_GeneralLib.IPDGeneral.VirtualArray_Calendar[AFFENRindexenreg, IPD_GeneralLib.IPDGeneral.CALENDAR_ColRecurrence_End] ;
   textBox28.Text  = IPD_GeneralLib.IPDGeneral.VirtualArray_Calendar[AFFENRindexenreg, IPD_GeneralLib.IPDGeneral.CALENDAR_ColEvery] ;
   textBox30.Text = IPD_GeneralLib.IPDGeneral.VirtualArray_Calendar[AFFENRindexenreg, IPD_GeneralLib.IPDGeneral.CALENDAR_ColDateAlarm] ;
   textBox29.Text = IPD_GeneralLib.IPDGeneral.VirtualArray_Calendar[AFFENRindexenreg, IPD_GeneralLib.IPDGeneral.CALENDAR_ColLocation] ;
   bIncomboautoselect = true ;
   comboBox1.SelectedIndex = AFFENRindexenreg ;       
   bIncomboautoselect = false ;
}

// Next record
void Button3Click(object sender, EventArgs e)
 {
   AFFENRindexenreg += 1 ;
  
   if (AFFENRindexenreg > AFFENRmaxnumenreg - 1)
      {
  	    AFFENRindexenreg = AFFENRmaxnumenreg - 1 ;
  	    return ;
     }
  
  displaycalendar() ;
}
        
// Previous record
void Button2Click(object sender, EventArgs e)
 {
   AFFENRindexenreg -= 1 ;
  
   if (AFFENRindexenreg < 0)
     {
      AFFENRindexenreg = 0 ;
      return ;
    }

  displaycalendar() ;
}
        
// Goto last record
void Button4Click(object sender, EventArgs e)
 {
   if (AFFENRindexenreg == AFFENRmaxnumenreg - 1)
        return ; // already last record
  
   AFFENRindexenreg = AFFENRmaxnumenreg - 1 ;
 
  displaycalendar() ;
}
        
// Goto first record
void Button5Click(object sender, EventArgs e)
 {
   if (AFFENRindexenreg == 0) // Already first record
  	   return ;
  
   AFFENRindexenreg = 0 ;
 
  displaycalendar() ;
}
        
// Close Form
void Button1Click(object sender, EventArgs e)
 {
   Close() ;
}
        
void ComboBox1SelectedIndexChanged(object sender, EventArgs e)
 {
   if (bIncomboautoselect == true)
       return ;

   AFFENRindexenreg = comboBox1.SelectedIndex ;

   bIncomboautoselect = true ;
   displaycalendar() ;
   bIncomboautoselect = false ;
}

    }
}
